package com.letfox.finance.service.impl;

import java.util.Date;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import com.letfox.common.model.ResultResponse;
import com.letfox.finance.model.user.FinAccountRlUAccount;
import com.letfox.finance.service.UUserFinIncomeService;
import com.letfox.finance.service.user.FinAccountRlUAccountService;

@Service
public class UUserFinIncomeServiceImpl implements UUserFinIncomeService{
	
	@Autowired
	private FinAccountRlUAccountService finAccountRlUAccountService;
	
	@Override
	public ResultResponse selectFimUser(String accountId) {
		ResultResponse resultResponse=new ResultResponse();
		FinAccountRlUAccount finAccountRlUAccount=finAccountRlUAccountService.selectByAccountId(accountId);
		resultResponse.setData(finAccountRlUAccount.getFinAccountId());
		return resultResponse;
	}

	@Override
	public ResultResponse saveFimUser(String accountId, String fimId) {
		ResultResponse resultResponse=new ResultResponse();
		FinAccountRlUAccount finAccountRlUAccount=new FinAccountRlUAccount();
		// 用户ID
		finAccountRlUAccount.setAccountId(accountId);
		//财务ID
		finAccountRlUAccount.setFinAccountId(fimId);
		//创建时间
		finAccountRlUAccount.setCreateTime(new Date());
		//修改时间
		finAccountRlUAccount.setUpdateTime(new Date());
		//创建人
		finAccountRlUAccount.setCreateBy("system");
		//修改人
		finAccountRlUAccount.setUpdateBy("system");
		//是否有效数据
		finAccountRlUAccount.setDel("0");
		int i=finAccountRlUAccountService.insert(finAccountRlUAccount);
		
		resultResponse.setData(i);
		return resultResponse;
	}
}
